/*****产品模板******/
import goodsTlpBean from "../porjectValue/GoodsTlpBean.js";

var goodsTlpCtrl = {
	goodsTlpBean: null, //模板信息
}

goodsTlpCtrl.setGoodsTplBean = function (data) {
	this.goodsTlpBean = new goodsTlpBean();
	if (data) {
		this.goodsTlpBean.setTlpInfoData(data);
	}
}

/*****草稿要保持模板到本地******/
goodsTlpCtrl.getTepmlateData = function () {
	if (!this.goodsTlpBean) return;
	let data = {};
	let tlp = this.goodsTlpBean;
	data.attr_ls = tlp.attrList;
	data.barcode = tlp.barCode;
	data.brand = tlp.brand;
	data.brand_m = tlp.brandMore;
	data.cost = tlp.cost;
	data.cost_quote_type = tlp.costQuoteTtype;
	data.desc = tlp.desc;
	data.id = tlp.id;
	data.item_no = tlp.itemNo;
	data.onsale = tlp.onSale;
	data.price_ls = tlp.priceList;
	data.price_quote_type = tlp.priceQuoteType;
	data.share = tlp.share;
	data.spec = tlp.spec;
	data.spec_ls = tlp.specList;
	data.tag = tlp.tag;
	data.tag_ls = tlp.tagList;
	data.time_tpl = tlp.timeTpl;
	data.title = tlp.title;
	data.txt = tlp.txt;
	data.unit = tlp.unit;
	data.money_q = tlp.money_q;
	data.pricec = tlp.pricec;
	data.outday = tlp.outday;

	return data;
}



/*****获取报价方式****/
goodsTlpCtrl.getPriceQuoteType = function () {
	return this.goodsTlpBean.priceQuoteType;
}

/****获取成本报价方式*****/
goodsTlpCtrl.getCostQuoteType = function () {
	return this.goodsTlpBean.costQuoteTtype;
}

/*******产品模板权限******BGEIN***/
/****是否可编辑有效期****/
goodsTlpCtrl.getOutdayLimit = function () {
	let result = false;
	if (this.goodsTlpBean) {
		result = this.goodsTlpBean.outday == 1 ? true : false;
	}
	return result;
}
/****是否可编辑条码****/
goodsTlpCtrl.getTplBarCodeLimit = function () {
	let result = false;
	console.log("this.goodsTlpBean.barCode============================================:",this.goodsTlpBean.barCode);
	if (this.goodsTlpBean) {
		result = this.goodsTlpBean.barCode == 1 ? true : false;
	}
	return result;
}

/****是否可编辑品牌****/
goodsTlpCtrl.getTplBrandLimit = function () {
	let result = false;
	if (this.goodsTlpBean) {
		result = this.goodsTlpBean.brand == 1 ? true : false;
	}
	return result;
}

/****是否可选择多品牌****/
goodsTlpCtrl.getTplBrandMoreLimit = function () {
	let result = false;
	if (this.goodsTlpBean) {
		result = this.goodsTlpBean.brandMore == 1 ? true : false;
	}
	return result;
}

/****是否可编辑成本****/
goodsTlpCtrl.getTplCostLimit = function () {
	let result = false;
	if (this.goodsTlpBean) {
		result = this.goodsTlpBean.cost == 1 ? true : false;
	}
	return result;
}

/****是否可编辑产品详情****/
goodsTlpCtrl.getTplDescLimit = function () {
	let result = false;
	if (this.goodsTlpBean) {
		result = this.goodsTlpBean.desc == 1 ? true : false;
	}
	return result;
}

/****是否可编辑货号****/
goodsTlpCtrl.getTplItemNoLimit = function () {
	let result = false;
	if (this.goodsTlpBean) {
		result = this.goodsTlpBean.itemNo == 1 ? true : false;
	}
	return result;
}

/****是否可编辑上架****/
goodsTlpCtrl.getTplOnSaleLimit = function () {
	let result = false;
	if (this.goodsTlpBean) {
		result = this.goodsTlpBean.onSale == 1 ? true : false;
	}
	return result;
}

/****是否可编辑分享文字****/
goodsTlpCtrl.getTplShareLimit = function () {
	let result = false;
	if (this.goodsTlpBean) {
		result = this.goodsTlpBean.share == 1 ? true : false;
	}
	return result;
}

/****是否可编辑产品规格****/
goodsTlpCtrl.getTplSpecLimit = function () {
	let result = false;
	if (this.goodsTlpBean) {
		result = this.goodsTlpBean.spec == 1 ? true : false;
	}
	return result;
}

/****是否可编辑标签****/
goodsTlpCtrl.getTplTagLimit = function () {
	let result = false; {
		result = this.goodsTlpBean.tag == 1 ? true : false;
	}
	return result;
}

/****是否可编辑产品名称****/
goodsTlpCtrl.getTplTitleLimit = function () {
	let result = false;
	if (this.goodsTlpBean) {
		result = this.goodsTlpBean.title == 1 ? true : false;
	}
	return result;
}

/****是否可编辑产品描述****/
goodsTlpCtrl.getTplTxtLimit = function () {
	let result = false;
	if (this.goodsTlpBean) {
		result = this.goodsTlpBean.txt == 1 ? true : false;
	}
	return result;
}

/****是否可编辑产品单位****/
goodsTlpCtrl.getTplUnitLimit = function () {
	let result = false;
	if (this.goodsTlpBean) {
		result = this.goodsTlpBean.unit == 1 ? true : false;
	}
	return result;
}

/***是否有优惠券****/
goodsTlpCtrl.hasCoupons = function () {
	let result = false;
	if (this.goodsTlpBean) {
		result = this.goodsTlpBean.coupons == 1 ? true : false;
	}
	return result;
}

/***是否有划线价格****/
goodsTlpCtrl.hasPricec = function () {
	let result = false;
	if (this.goodsTlpBean) {
		result = this.goodsTlpBean.pricec == 1 ? true : false;
	}
	return result;
}

/*******产品模板权限******END***/

export default goodsTlpCtrl;